<?php
//开放API接口公共类
namespace Openapi\Controller;
use Common\Controller\BaseController;
abstract class CommonController extends BaseController {	

	protected $site_key;//网站密钥
	protected $order_info;//订单信息	

	public function _initialize() {
		//继承前面的配置
		parent::_initialize();
		//调用后台配置，启用设置主题
		C("DEFAULT_THEME",$this->web_config['web_theme']);	
		//配置多语言
		//cookie("think_language",$this->web_config['web_default_lang']);	
		if(!$this->web_config['web_isopen']){
			$result['status']=0;
			$result['info']=$this->web_config['web_close_desc'];
			$this->ajaxReturn($result);
		}
	}
	
		/**
	*订单类接口准备函数，所有方法调用前都会调调该方法
	*@param $mid 商户ID
	*@param $site_id 网站ID
	* @param $oid  平台订单号	
	*/
	protected function prepare($mid="",$site_id="",$oid=""){
		$con['order_mid']=$mid;
		$con['order_siteid']=$site_id;
		$con['order_id']=$oid;
		$con['ips_id']=array("neq","[TEST]");
		$this->order_info=D("OrdersView")->field(true)->where($con)->find();
		//网站密钥
		$this->site_key=$this->order_info['site_key'];			
		//echo D("OrdersView")->_sql();
		if(!$this->order_info)
			return false;
		else
			return true;
	}

}

